import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.util.Vector;


public class ConicLine extends OrientedShape {
	
	private double radius;
	private double angle;
	private double width;

	public ConicLine(double width, double radius, double angle) {
		super();
		this.width = width;
		this.radius = radius;
		this.angle = angle;
	}
	
	public double getRadius() {
		return radius;
	}

	public void setRadius(double radius) {
		this.radius = radius;
	}
	
	public double getWidth() {
		return width;
	}
	public void setWidth(double width) {
		this.width = width;
	}
	
	public double getAngle() {
		return angle;
	}
	
	public void setAngle(double angle) {
		this.angle = angle;
	}
	
	public Line getLine(){
		Line line = new Line(radius, width);
		line.origin = (Point2D.Double) origin.clone();
		line.direction = (Line2D) direction.clone();
		return line;
	}
	
	public Cone getRightCone(){
		Cone cone = new Cone(radius, angle/2);
		cone.origin = getLine().getP1();
		double dirAngle = Math.atan2(direction.getY2(), direction.getX2())*180/Math.PI;
		cone.setDirectionDegree(dirAngle - angle/4);
		return cone;
	}
	
	public Cone getLeftCone(){
		Cone cone = new Cone(radius, angle/2);
		cone.origin = getLine().getP4();
		double dirAngle = Math.atan2(direction.getY2(), direction.getX2())*180/Math.PI;
		cone.setDirectionDegree(dirAngle + angle/4);
		return cone;
	}

	public Vector<Shape> getShapes(){
		Vector<Shape> res = new Vector<Shape>();
		res.add(getLine());
		res.add(getLeftCone());
		res.add(getRightCone());
		return res;
	}
	
	public Vector<Line> getLineDistribution(double granularity){
		Vector<Line> res = new Vector<Line>();
		
		res.addAll(getLine().getLineDistribution(granularity, false));
		res.addAll(getLeftCone().getLineDistribution(granularity));
		res.addAll(getRightCone().getLineDistribution(granularity));
		
		return res;
	}
	
	public Vector<Circle> getCircleDistribution(double granularity){
		Vector<Circle> res = new Vector<Circle>();
		
		res.addAll(getLine().getCircleDistribution(granularity, false));
		res.addAll(getLeftCone().getCircleDistribution(granularity));
		res.addAll(getRightCone().getCircleDistribution(granularity));
		
		return res;
	}

}
